package cn.gailvlun.gll.presentation.emotion.drawer

import android.content.Context
import cn.gailvlun.gll.R
import cn.gailvlun.gll.net.emotion.Emotion
import cn.gailvlun.gll.presentation.emotion.core.BaseAdapter
import org.jetbrains.annotations.NotNull


class EmotionPersonalAdapter : BaseAdapter<Any> {

    constructor(context: Context) : super(context) {
        addViewTypeToLayoutMap(Type.EMPTY.ordinal, R.layout.item_emotion_personal_empty)
        addViewTypeToLayoutMap(Type.Calendar.ordinal, R.layout.item_emotion_personal_calendar)
        addViewTypeToLayoutMap(Type.CONTENT.ordinal, R.layout.item_emotion_personal_emotion)
        addViewTypeToLayoutMap(Type.HEADER.ordinal, R.layout.item_emotion_personal_header)
    }

    enum class Type {
        EMPTY,
        CONTENT,
        Calendar,
        HEADER
    }

    override fun removeCondition(@NotNull whichItem: Any, @NotNull certainItem: Any): Boolean {
        whichItem as Emotion
        certainItem as Emotion
        return whichItem.id == certainItem.id || super.removeCondition(whichItem, certainItem)
    }

    override fun notifyItemChangedCondition(whichItem: Any, certainItem: Any): Boolean {
        whichItem as Emotion
        certainItem as Emotion
        return whichItem.id == certainItem.id || super.notifyItemChangedCondition(whichItem, certainItem)
    }

}